package com.zib.bilibili.customview;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.jcodecraeer.xrecyclerview.XRecyclerView;
import com.zib.bilibili.R;
import com.zib.bilibili.bean.LiveBean;

import java.util.List;

import butterknife.Bind;

/**
 * Created by Administrator on 2016/7/5.
 */
public class LiveItemView extends View {
    private String imageUrl;
    private String iconUrl;
    private String username;
    private String liveCount;
    private String liveTitle;
    ImageView imageViewLiveImage;
    ImageView imageViewLiveIcon;
    TextView textViewLiveUsername;
    TextView textViewLiveCount;
    TextView textViewLiveTitle;

    public LiveItemView(Context context) {
        super(context);
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        inflater.inflate(R.layout.item_gridviewitem_live, null, false);
        imageViewLiveIcon = (ImageView) findViewById(R.id.imageView_live_icon);
        imageViewLiveImage = (ImageView) findViewById(R.id.imageView_live_image);
        textViewLiveCount = (TextView) findViewById(R.id.textView_live_count);
        textViewLiveTitle = (TextView) findViewById(R.id.textView_live_title);
        textViewLiveUsername = (TextView) findViewById(R.id.textView_live_username);
    }

    public LiveItemView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public void getData(String imageUrl, String iconUrl, String username, String liveCount, String liveTitle) {
        this.iconUrl = iconUrl;
        this.imageUrl = imageUrl;
        this.liveCount = liveCount;
        this.liveTitle = liveTitle;
        this.username = username;
    }

    public void setData() {
        Glide.with(getContext()).load(imageUrl).into(imageViewLiveImage);
        Glide.with(getContext()).load(iconUrl).into(imageViewLiveIcon);
        textViewLiveUsername.setText(username);
        textViewLiveTitle.setText(liveTitle);
        textViewLiveCount.setText(liveCount);
    }


}
